Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flatted

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flatted

A super light and fast circular JSON parser.

  • 3.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49M
increased by13.98%
Maintainers
1
Weekly downloads
 
Created

What is flatted?

The flatted npm package is a library for encoding and decoding JavaScript objects into a flat JSON format. It is particularly useful for handling circular references and complex data structures that JSON.stringify cannot handle by default.

What are flatted's main functionalities?

Encoding objects with circular references

Flatted allows you to encode objects that have circular references, which would throw an error with JSON.stringify. For example, if you have an object 'circularObj' that references itself, you can use flatted.stringify(circularObj) to get a string representation of the object.

{"encoded": "flatted.stringify(circularObj)"}

Decoding flatted strings back to objects

After encoding an object with circular references using flatted, you can decode the resulting string back into an object with flatted.parse(flattedString). This will restore the circular references and give you back the original object structure.

{"decoded": "flatted.parse(flattedString)"}

Other packages similar to flatted

Keywords

FAQs

Package last updated on 18 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc